package com.xaslsoft.xaslsoft.device.net;


import org.smartboot.http.server.HttpBootstrap;
import org.smartboot.http.server.handle.WebSocketDefaultHandle;


/**
 * 串口通讯
 *
 * @author hlx
 */
public class WebSocketServer implements Runnable {
	private final HttpBootstrap bootstrap = new HttpBootstrap();
	private int port;
	private WebSocketDefaultHandle handle;

	public WebSocketServer(int port, WebSocketDefaultHandle handle) {
		this.port = port;
		this.handle = handle;
	}

	@Override
	public void run() {
		// websocket请求
		bootstrap.wsPipeline().next(handle);
		bootstrap.setPort(port).start();
	}
}
